{% extends "base.html" %}

{% block title %}分析侦察数据 - 协同调度信息系统{% endblock %}

{% block content %}
<div class="row">
    <div class="col-md-4">
        <!-- 侦察数据信息 -->
        <div class="card">
            <div class="card-header">
                <h6 class="mb-0">
                    <i class="fas fa-search"></i> 侦察数据信息
                </h6>
            </div>
            <div class="card-body">
                <h6>{{ recon_data.title }}</h6>
                <p><strong>目标系统:</strong> {{ recon_data.target_system }}</p>
                <p><strong>数据类型:</strong> 
                    {% if recon_data.data_type == 'network' %}网络信息
                    {% elif recon_data.data_type == 'system' %}系统信息
                    {% elif recon_data.data_type == 'vulnerability' %}漏洞信息
                    {% elif recon_data.data_type == 'user' %}用户信息
                    {% elif recon_data.data_type == 'service' %}服务信息
                    {% else %}其他
                    {% endif %}
                </p>
                <p><strong>优先级:</strong> 
                    <span class="priority-badge priority-{{ recon_data.priority }}">
                        {% if recon_data.priority == 'low' %}低
                        {% elif recon_data.priority == 'medium' %}中
                        {% elif recon_data.priority == 'high' %}高
                        {% elif recon_data.priority == 'critical' %}紧急
                        {% endif %}
                    </span>
                </p>
                <p><strong>提交时间:</strong> {{ recon_data.created_at.strftime('%Y-%m-%d %H:%M') }}</p>
            </div>
        </div>

        <!-- 侦察内容 -->
        <div class="card mt-3">
            <div class="card-header">
                <h6 class="mb-0">
                    <i class="fas fa-file-text"></i> 侦察内容
                </h6>
            </div>
            <div class="card-body">
                <div class="bg-light p-3 rounded" style="max-height: 300px; overflow-y: auto;">
                    <pre style="white-space: pre-wrap; margin: 0; font-size: 0.9rem;">{{ recon_data.content }}</pre>
                </div>
            </div>
        </div>
    </div>

    <div class="col-md-8">
        <!-- 分析表单 -->
        <div class="card">
            <div class="card-header">
                <h5 class="mb-0">
                    <i class="fas fa-chart-line"></i> 数据分析
                </h5>
            </div>
            <div class="card-body">
                <form method="POST">
                    {{ form.hidden_tag() }}
                    
                    <div class="row">
                        <div class="col-md-6">
                            <div class="mb-3">
                                {{ form.analysis_type.label(class="form-label") }}
                                {{ form.analysis_type(class="form-select") }}
                                {% if form.analysis_type.errors %}
                                    <div class="text-danger">
                                        {% for error in form.analysis_type.errors %}
                                            <small>{{ error }}</small>
                                        {% endfor %}
                                    </div>
                                {% endif %}
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="mb-3">
                                {{ form.confidence_level.label(class="form-label") }}
                                {{ form.confidence_level(class="form-select") }}
                                {% if form.confidence_level.errors %}
                                    <div class="text-danger">
                                        {% for error in form.confidence_level.errors %}
                                            <small>{{ error }}</small>
                                        {% endfor %}
                                    </div>
                                {% endif %}
                            </div>
                        </div>
                    </div>

                    <div class="mb-3">
                        {{ form.findings.label(class="form-label") }}
                        {{ form.findings(class="form-control", rows="6", placeholder="请详细描述分析发现...") }}
                        {% if form.findings.errors %}
                            <div class="text-danger">
                                {% for error in form.findings.errors %}
                                    <small>{{ error }}</small>
                                {% endfor %}
                            </div>
                        {% endif %}
                        <div class="form-text">
                            <i class="fas fa-info-circle"></i>
                            请详细描述通过分析发现的关键信息、威胁、漏洞或机会
                        </div>
                    </div>

                    <div class="mb-3">
                        {{ form.recommendations.label(class="form-label") }}
                        {{ form.recommendations(class="form-control", rows="5", placeholder="请提供具体的建议措施...") }}
                        {% if form.recommendations.errors %}
                            <div class="text-danger">
                                {% for error in form.recommendations.errors %}
                                    <small>{{ error }}</small>
                                {% endfor %}
                            </div>
                        {% endif %}
                        <div class="form-text">
                            <i class="fas fa-info-circle"></i>
                            基于分析结果，提供具体的建议措施和应对策略
                        </div>
                    </div>

                    <div class="mb-3">
                        {{ form.priority_targets.label(class="form-label") }}
                        {{ form.priority_targets(class="form-control", rows="3", placeholder="请列出优先处理的目标...") }}
                        {% if form.priority_targets.errors %}
                            <div class="text-danger">
                                {% for error in form.priority_targets.errors %}
                                    <small>{{ error }}</small>
                                {% endfor %}
                            </div>
                        {% endif %}
                        <div class="form-text">
                            <i class="fas fa-info-circle"></i>
                            列出需要优先处理的目标或系统（可选）
                        </div>
                    </div>

                    <div class="mb-3">
                        {{ form.suggested_actions.label(class="form-label") }}
                        {{ form.suggested_actions(class="form-control", rows="3", placeholder="请提供建议的行动方案...") }}
                        {% if form.suggested_actions.errors %}
                            <div class="text-danger">
                                {% for error in form.suggested_actions.errors %}
                                    <small>{{ error }}</small>
                                {% endfor %}
                            </div>
                        {% endif %}
                        <div class="form-text">
                            <i class="fas fa-info-circle"></i>
                            提供具体的行动建议和实施方案（可选）
                        </div>
                    </div>

                    <div class="d-grid gap-2 d-md-flex justify-content-md-end">
                        <a href="{{ url_for('analyst_dashboard') }}" class="btn btn-secondary me-md-2">
                            <i class="fas fa-arrow-left"></i> 返回
                        </a>
                        {{ form.submit(class="btn btn-primary") }}
                    </div>
                </form>
            </div>
        </div>

        <!-- 分析指导 -->
        <div class="card mt-4">
            <div class="card-header">
                <h6 class="mb-0">
                    <i class="fas fa-lightbulb"></i> 分析指导
                </h6>
            </div>
            <div class="card-body">
                <div class="row">
                    <div class="col-md-6">
                        <h6><i class="fas fa-exclamation-triangle text-danger"></i> 威胁分析要点:</h6>
                        <ul class="list-unstyled small">
                            <li><i class="fas fa-arrow-right text-primary"></i> 识别潜在的安全威胁</li>
                            <li><i class="fas fa-arrow-right text-primary"></i> 评估威胁的影响范围</li>
                            <li><i class="fas fa-arrow-right text-primary"></i> 分析威胁的利用可能性</li>
                            <li><i class="fas fa-arrow-right text-primary"></i> 提供防护建议</li>
                        </ul>
                    </div>
                    <div class="col-md-6">
                        <h6><i class="fas fa-bug text-warning"></i> 漏洞分析要点:</h6>
                        <ul class="list-unstyled small">
                            <li><i class="fas fa-arrow-right text-primary"></i> 识别系统安全漏洞</li>
                            <li><i class="fas fa-arrow-right text-primary"></i> 评估漏洞的严重程度</li>
                            <li><i class="fas fa-arrow-right text-primary"></i> 分析漏洞的利用条件</li>
                            <li><i class="fas fa-arrow-right text-primary"></i> 提供修复建议</li>
                        </ul>
                    </div>
                </div>
                <div class="row mt-3">
                    <div class="col-md-6">
                        <h6><i class="fas fa-star text-success"></i> 机会分析要点:</h6>
                        <ul class="list-unstyled small">
                            <li><i class="fas fa-arrow-right text-primary"></i> 识别可利用的机会</li>
                            <li><i class="fas fa-arrow-right text-primary"></i> 评估机会的价值</li>
                            <li><i class="fas fa-arrow-right text-primary"></i> 分析实现条件</li>
                            <li><i class="fas fa-arrow-right text-primary"></i> 提供行动建议</li>
                        </ul>
                    </div>
                    <div class="col-md-6">
                        <h6><i class="fas fa-chart-pie text-info"></i> 综合分析要点:</h6>
                        <ul class="list-unstyled small">
                            <li><i class="fas fa-arrow-right text-primary"></i> 多维度综合分析</li>
                            <li><i class="fas fa-arrow-right text-primary"></i> 识别关键风险点</li>
                            <li><i class="fas fa-arrow-right text-primary"></i> 提供整体策略建议</li>
                            <li><i class="fas fa-arrow-right text-primary"></i> 制定优先级排序</li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
